﻿package mortal.game.view.palyer.view
{
    import Message.DB.Tables.*;
    import Message.Game.*;
    import Message.Public.*;
    import baseEngine.modifiers.*;
    import com.gengine.core.frame.*;
    import com.gengine.resource.*;
    import com.mui.controls.*;
    import com.mui.utils.*;
    import extend.language.*;
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.utils.*;
    import frEngine.*;
    import frEngine.effectEditTool.temple.*;
    import frEngine.event.*;
    import frEngine.pools.*;
    import frEngine.primitives.object2d.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.common.net.*;
    import mortal.common.swfPlayer.*;
    import mortal.component.rotate3dModelSprite.*;
    import mortal.component.window.*;
    import mortal.game.cache.*;
    import mortal.game.events.*;
    import mortal.game.manager.*;
    import mortal.game.manager.msgTip.*;
    import mortal.game.manager.window3d.*;
    import mortal.game.model.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.resource.tableConfig.*;
    import mortal.game.scene3D.map3D.util.*;
    import mortal.game.scene3D.model.player.*;
    import mortal.game.scene3D.model.player.weapon.*;
    import mortal.game.scene3D.model.pools.*;
    import mortal.game.scene3D.player.entity.*;
    import mortal.game.scene3D.player.type.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.cd.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.common.tooltip.*;
    import mortal.game.view.guide.*;
    import mortal.game.view.mount.data.*;
    import mortal.game.view.mount.panel.*;
    import mortal.game.view.palyer.data.*;
    import mortal.game.view.palyer.util.*;
    import mortal.game.view.systemSetting.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class FashionAdvanceWin extends BaseWindow
    {
        protected var _bg:GBitmap;
        protected var _leftBtn:GLoadedButton;
        protected var _rightBtn:GLoadedButton;
        protected var _changeBtn:GLoadingButton;
        protected var _imgHuaWenLeft:GBitmap;
        protected var _imgHuaWenRight:GBitmap;
        protected var _progressBar:BaseProgressBar;
        protected var _consumeItem:BaseItem;
        protected var _commonAdvanceBtn:GButton;
        protected var _autoAdvanceBtn:GButton;
        protected var _autoBuy:GCheckBox;
        protected var _levelInfo:GTextFiled;
        protected var _advanceInfo:GTextFiled;
        protected var _propNum:GTextFiled;
        protected var _cancelBtn:GButton;
        protected var _consumeBg:GBitmap;
        protected var _txtAfterAdvance:GBitmap;
        protected var _arrow:SWFPlayer;
        protected var _rect3d:Rect3DObject;
        protected var _img2d:Img2D;
        protected var _roleModelPlayer:UserModelPlayer;
        protected var _rotate3d:Rotate3dModelSprite;
        protected var _advanceEffectPlayer:EffectPlayer;
        protected var _weaponPlayer:WeaponPlayer;
        protected var _weaponEffectPlayer:EffectPlayer;
        protected var _fightSoulEffectPlayer:EffectPlayer;
        protected var _fightSoulModelPlayer:ActionPlayer;
        protected var _data:FashionAdvanceData;
        protected var _currSelCode:int;
        protected var _hideCallBack:Function;
        protected var _isRoleModelDisposed:Boolean = true;
        protected var _isWeaponModelDisposed:Boolean = true;
        protected var _isFightSoulDisposed:Boolean = true;
        protected var _frameTimer:FrameTimer;
        protected var _isCreateChildren:Boolean;
        protected var _isAddBtnFilter:Boolean;
        private var _isRightTop:Boolean;
        private var _turnNum:Number = 0;
        protected var _isCommonAdvance:Boolean;
        protected var _swfPlayer:SWFPlayer;
        protected var _isPlaying:Boolean;
        private var _isShowClothBlessWin:Boolean = true;
        private var _isShowWingBlessWin:Boolean = true;
        private var _isShowArtifactBlessWin:Boolean = true;
        private var _isShowFightSoulBlessWin:Boolean = true;
        private var _isShowFightMethodBlessWin:Boolean = true;
        private var _isShowDragonSoulBlessWin:Boolean = true;
        private var _isAutoAdvance:Boolean = false;
        private var _callLaterId:int;
        private var _isStopAdvance:Boolean;
        private var _cdData:ICDData;
        private var _cdType:String;
        private static var _instance:FashionAdvanceWin;
        public static var isOpenByOtherMethod:Boolean;

        public function FashionAdvanceWin(param1:ILayer = null)
        {
            if (_instance)
            {
                throw new Error(" FashionAdvanceWin 单例 ");
            }
            setSize(343 - 2, 500);
            this.layer = LayerManager.windowLayer3D;
            isForbidenDrag = true;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._bg = UIFactory.gBitmap("");
            isForbidenDrag = true;
            this.createChildren();
            LoaderManager.instance.load(ImagesConst.ClothesWingBg2 + ".swf", this.onBgLoadCompl);
            return;
        }// end function

        protected function onResLoadCompl() : void
        {
            if (isDisposed)
            {
                return;
            }
            this.createChildren();
            return;
        }// end function

        protected function createChildren() : void
        {
            this._rotate3d = UIFactory.getUICompoment(Rotate3dModelSprite, 0, 33, this.contentTopOf3DSprite);
            this._rotate3d.setSize(336, 370);
            this.pushUIToDisposeVec(UIFactory.gBitmap(ImagesConst.Fashion_ClothWingTitleBg, 3, 40, this.contentTopOf3DSprite));
            this._leftBtn = UIFactory.gLoadedButton(ImagesConst.WingLeft_upSkin, 14 + 5, 42 + 3, 23, 26, this.contentTopOf3DSprite);
            this._leftBtn.configEventListener(MouseEvent.CLICK, this.onTurnPageClick);
            this._rightBtn = UIFactory.gLoadedButton(ImagesConst.WingRight_upSkin, 306, 42 + 3, 23, 26, this.contentTopOf3DSprite);
            this._rightBtn.configEventListener(MouseEvent.CLICK, this.onTurnPageClick);
            this._txtAfterAdvance = UIFactory.gBitmap(ImagesConst.Fashion_Text_AfterAdvance, 82 + 7, 45 + 3, this.contentTopOf3DSprite);
            var _loc_1:* = GlobalStyle.textFormatBai;
            _loc_1.size = 14;
            this._levelInfo = UIFactory.gTextField("", 42, 45, 170, 25, this.contentTopOf3DSprite, _loc_1);
            this._changeBtn = UIFactory.gLoadingButton(ResFileConst.fashionShapChangeBtn, 156 + 8, 72 + 3, 27, 26, this.contentTopOf3DSprite);
            this._changeBtn.configEventListener(MouseEvent.CLICK, this.onChangeClick);
            this._changeBtn.visible = false;
            this._imgHuaWenLeft = UIFactory.gBitmap(ImagesConst.GroupCopySide, 49, 406, this.contentTopOf3DSprite);
            this._imgHuaWenRight = UIFactory.gBitmap(ImagesConst.GroupCopySide, 226 + 74, 406, this.contentTopOf3DSprite);
            this._imgHuaWenRight.scaleX = -1;
            var _loc_2:* = GlobalStyle.textFormatBai;
            _loc_2.size = 13;
            this._advanceInfo = UIFactory.gTextField("", 130 + 3, 401 - 5, 100, 20, this.contentTopOf3DSprite, _loc_2);
            this._progressBar = UICompomentPool.getUICompoment(BaseProgressBar);
            this._progressBar.setBg(ImagesConst.StrengthenBarBg2, true, 268, 13);
            this._progressBar.setProgress(ImagesConst.StrengthenBar2, true, 14, 1, 240, 12);
            this._progressBar.setLabel(BaseProgressBar.ProgressBarTextOnlyShowValue, 186 - 158 + 12, -4, 200, 20, GlobalStyle.textFormatHuang);
            this._progressBar.x = 7 + 2 + 32;
            this._progressBar.y = 421 + 5 - 7;
            this._progressBar.toolTipData = this.getFashionAdvanceToolTipInfo;
            this.contentTopOf3DSprite.addChild(this._progressBar);
            this.pushUIToDisposeVec(UIFactory.gTextField(Language.getString(35519), 8 + 2, 450 - 4, 63, 20, this.contentTopOf3DSprite));
            this._consumeBg = UIFactory.gBitmap(ImagesConst.PackItemBg, 12, 470, this.contentTopOf3DSprite);
            this._consumeBg.scaleX = 0.7;
            this._consumeBg.scaleY = 0.7;
            this._consumeItem = UICompomentPool.getUICompoment(BaseItem);
            this._consumeItem.x = 12 - 1;
            this._consumeItem.y = 470 - 1;
            this._consumeItem.isDragAble = false;
            this.contentTopOf3DSprite.addChild(this._consumeItem);
            this._consumeItem.setItemStyle(26, "", 2, 2);
            this._propNum = UIFactory.gTextField("*100", 12 + 28, 470 + 3, 37, 20, this.contentTopOf3DSprite);
            this._commonAdvanceBtn = UIFactory.gButton("进阶", (92 + 1), 446 + 3, 78, 26, this.contentTopOf3DSprite, "RedButton");
            this._arrow = UICompomentPool.getUICompoment(SWFPlayer);
            if (FashionAdvanceWin.isOpenByOtherMethod == true)
            {
                EffectManager.glowFilterReg(this._commonAdvanceBtn);
                this.addArrow();
                this._isAddBtnFilter = true;
            }
            this._autoAdvanceBtn = UIFactory.gButton("自动进阶", (182 + 1), 446 + 3, 78, 26, this.contentTopOf3DSprite, "RedButton");
            this._autoAdvanceBtn.visible = true;
            this._cancelBtn = UIFactory.gButton("取消进阶", (182 + 1), 446 + 3, 78, 26, this.contentTopOf3DSprite, "RedButton");
            this._cancelBtn.visible = false;
            this._commonAdvanceBtn.configEventListener(MouseEvent.CLICK, this.onAdvanceHandler);
            this._autoAdvanceBtn.configEventListener(MouseEvent.CLICK, this.onAdvanceHandler);
            this._cancelBtn.configEventListener(MouseEvent.CLICK, this.onAdvanceHandler);
            this._commonAdvanceBtn.configEventListener(MouseEvent.MOUSE_OVER, this.onOverHandler);
            this._autoAdvanceBtn.configEventListener(MouseEvent.MOUSE_OVER, this.onOverHandler);
            this._cancelBtn.configEventListener(MouseEvent.MOUSE_OVER, this.onOverHandler);
            this._commonAdvanceBtn.configEventListener(MouseEvent.MOUSE_OUT, this.onOutHandler);
            this._autoAdvanceBtn.configEventListener(MouseEvent.MOUSE_OUT, this.onOutHandler);
            this._cancelBtn.configEventListener(MouseEvent.MOUSE_OUT, this.onOutHandler);
            this._autoBuy = UIFactory.checkBox("道具不足，自动购买", 100 + 14, 446 + 26, 140, 28, this.contentTopOf3DSprite);
            this._autoBuy.configEventListener(MouseEvent.CLICK, this.onAutoBuyClickHandler);
            this._swfPlayer = UICompomentPool.getUICompoment(SWFPlayer);
            this.addListeners();
            this.initAutoBuyState();
            this.updateAll();
            return;
        }// end function

        private function addListeners() : void
        {
            NetDispatcher.addCmdListener(ServerCommand.FashionInfoUpdate, this.onFashionInfoUpdate);
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsChange, this.backPackItemChangeHandler);
            NetDispatcher.addCmdListener(ServerCommand.FashionUpdateExpiredTime, this.onExpiredTimeUpdate);
            Dispatcher.addEventListener(EventName.FashionOnceAdvance, this.onFashionAdvanceCompl);
            Dispatcher.addEventListener(EventName.FashionAutoAdvance, this.onAutoAdvanceHandler);
            Dispatcher.addEventListener(EventName.FashionCancelAutoAdvance, this.onCancelAutoAdvance);
            return;
        }// end function

        private function removeListeners() : void
        {
            NetDispatcher.removeCmdListener(ServerCommand.FashionInfoUpdate, this.onFashionInfoUpdate);
            NetDispatcher.removeCmdListener(ServerCommand.BackPackItemsChange, this.backPackItemChangeHandler);
            NetDispatcher.addCmdListener(ServerCommand.FashionUpdateExpiredTime, this.onExpiredTimeUpdate);
            Dispatcher.removeEventListener(EventName.FashionOnceAdvance, this.onFashionAdvanceCompl);
            Dispatcher.removeEventListener(EventName.FashionAutoAdvance, this.onAutoAdvanceHandler);
            Dispatcher.removeEventListener(EventName.FashionCancelAutoAdvance, this.onCancelAutoAdvance);
            return;
        }// end function

        protected function initAutoBuyState() : void
        {
            if (ClientSetting.local.getIsDone(IsDoneType.AutoBuyAdvanceProp))
            {
                this._autoBuy.selected = true;
            }
            else
            {
                this._autoBuy.selected = false;
            }
            return;
        }// end function

        protected function onBgLoadCompl(param1) : void
        {
            if (isDisposed)
            {
                return;
            }
            this._bg.bitmapData = param1.bitmapData as BitmapData;
            this.init3DRect();
            this.add3dBg();
            this.initModel();
            return;
        }// end function

        public function set data(param1:FashionAdvanceData) : void
        {
            this._data = param1;
            if (this._isAutoAdvance)
            {
                this.cancelAutoAdvance();
                this._isStopAdvance = true;
            }
            if (!isDisposed)
            {
                this.updateAll();
            }
            return;
        }// end function

        protected function onTurnPageClick(event:MouseEvent) : void
        {
            var _loc_2:String = null;
            if (event.target == this._leftBtn)
            {
                (this._currSelCode - 1);
            }
            else if (event.target == this._rightBtn)
            {
                if (this._isRightTop)
                {
                    _loc_2 = FashionUtil.getFashionNameByType(this._data.type);
                    MsgManager.showRollTipsMsg("进阶后即可查看下阶" + _loc_2);
                    return;
                }
                (this._currSelCode + 1);
            }
            this.clearBtnState();
            this.updateSwitchBtnState();
            this.updateChangeBtnState();
            this.updateRoleModel();
            this.updateLevelInfo();
            return;
        }// end function

        protected function onChangeClick(event:MouseEvent) : void
        {
            GameProxy.fashion.changeShape(this._currSelCode, this._data.type);
            return;
        }// end function

        protected function updateAll() : void
        {
            if (this._data && this._data.advanceInfo)
            {
                this.updateCurrShap((this._data.advanceInfo.code + 1));
                this.updateLevelInfo();
                this.clearBtnState();
                this.updateSwitchBtnState();
                this.updateChangeBtnState();
                this.updateAdvanceInfo();
                this.updateProgressInfo();
                this.updateConsumeInfo();
                this.updateCd();
                this.updateAdvanceBtnState();
                if (this._roleModelPlayer != null || this._weaponPlayer != null || this._fightSoulModelPlayer != null)
                {
                    this.updateRoleModel();
                }
            }
            return;
        }// end function

        protected function updateCurrShap(param1:int = 0) : void
        {
            if (param1 == 0)
            {
                this._currSelCode = this._data.advanceInfo.shapeCode;
            }
            else
            {
                this._currSelCode = param1 > ClothWingConst.AdvanceMaxLevel ? (ClothWingConst.AdvanceMaxLevel) : (param1);
            }
            return;
        }// end function

        protected function updateLevelInfo() : void
        {
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            var _loc_1:* = this.getLevelInfo(this._currSelCode);
            if (_loc_1)
            {
                this._levelInfo.text = _loc_1.code + "阶 " + _loc_1.name;
            }
            if (this._currSelCode <= this._data.advanceInfo.code)
            {
                this._txtAfterAdvance.visible = false;
                this._levelInfo.x = (this.width - this._levelInfo.textWidth) / 2;
            }
            else
            {
                this._txtAfterAdvance.visible = true;
                _loc_2 = this._txtAfterAdvance.bitmapData.width + this._levelInfo.textWidth;
                _loc_3 = (this.width - _loc_2) / 2;
                this._txtAfterAdvance.x = _loc_3;
                this._levelInfo.x = this._txtAfterAdvance.x + this._txtAfterAdvance.width + 5;
            }
            return;
        }// end function

        protected function getLevelInfo(param1:int) : TMountConfig
        {
            return MountConfig.instance.getFashionInfoByCode(this._data.type, param1);
        }// end function

        protected function updateSwitchBtnState() : void
        {
            if (this._currSelCode <= 1)
            {
                this._leftBtn.filterEnabled = false;
            }
            if (this._currSelCode > this._data.advanceInfo.code || this._currSelCode == FashionConst.FashionAdvanceMaxLevel)
            {
                this._rightBtn.filterEnabled = false;
                if (this._currSelCode != FashionConst.FashionAdvanceMaxLevel)
                {
                    this._rightBtn.mouseEnabled = true;
                    this._isRightTop = true;
                }
            }
            return;
        }// end function

        protected function updateChangeBtnState() : void
        {
            if (this._data.advanceInfo.code < 4)
            {
                this._changeBtn.visible = false;
                return;
            }
            this._changeBtn.visible = true;
            if (this._currSelCode == this._data.advanceInfo.shapeCode || this._currSelCode > this._data.advanceInfo.code)
            {
                this._changeBtn.filterEnabled = false;
            }
            else
            {
                this._changeBtn.filterEnabled = true;
            }
            return;
        }// end function

        protected function clearBtnState() : void
        {
            this._leftBtn.filterEnabled = true;
            this._rightBtn.filterEnabled = true;
            this._isRightTop = false;
            this._changeBtn.filterEnabled = true;
            return;
        }// end function

        protected function updateAdvanceBtnState() : void
        {
            if (FashionAdvanceWin.isOpenByOtherMethod && !this._isAddBtnFilter && FashionUtil.isFashionCanAdvanceSucc(this._data.advanceInfo.type, false))
            {
                EffectManager.glowFilterReg(this._commonAdvanceBtn);
                this.addArrow();
            }
            return;
        }// end function

        protected function updateRoleModel() : void
        {
            var _loc_1:TMountConfig = null;
            var _loc_2:int = 0;
            var _loc_3:int = 0;
            var _loc_4:int = 0;
            var _loc_5:TPlayerModel = null;
            var _loc_6:int = 0;
            if (this._data.type == EAdvanceComponentType._EAdvanceComponentTypeClothes)
            {
                if (!this._isWeaponModelDisposed)
                {
                    this.removeWeaponModel();
                }
                if (!this._isFightSoulDisposed)
                {
                    this.removeFightSoulPlayer();
                }
                if (this._isRoleModelDisposed)
                {
                    this.initUserModel();
                    this._rect3d.addObject3d(this._roleModelPlayer, 73 + 72 + 14, 133 + 223);
                    this._isRoleModelDisposed = false;
                }
                _loc_1 = MountConfig.instance.getFashionInfoByCode(this._data.type, this._currSelCode);
                if (_loc_1 != null)
                {
                    this._roleModelPlayer.clothes = _loc_1.modelId;
                }
                this._roleModelPlayer.wing = 0;
                this._roleModelPlayer.weapon = 0;
                this._roleModelPlayer.loadClothes();
                this._roleModelPlayer.loadWing();
                this._roleModelPlayer.loadWeapon();
            }
            if (this._data.type == EAdvanceComponentType._EAdvanceComponentTypeWing)
            {
                if (!this._isWeaponModelDisposed)
                {
                    this.removeWeaponModel();
                }
                if (!this._isFightSoulDisposed)
                {
                    this.removeFightSoulPlayer();
                }
                if (this._isRoleModelDisposed)
                {
                    this.initUserModel();
                    this._rect3d.addObject3d(this._roleModelPlayer, 73 + 72 + 14, 133 + 223);
                    this._isRoleModelDisposed = false;
                }
                _loc_1 = MountConfig.instance.getFashionInfoByCode(this._data.type, this._currSelCode);
                this._roleModelPlayer.clothes = Cache.instance.role.roleEntityInfo.clothes;
                if (GameMapUtil.curMapState.isSunbathMap)
                {
                    this._roleModelPlayer.clothes = 0;
                }
                if (_loc_1 != null)
                {
                    this._roleModelPlayer.wing = _loc_1.modelId;
                }
                this._roleModelPlayer.weapon = 0;
                this._roleModelPlayer.loadClothes();
                this._roleModelPlayer.loadWing();
                this._roleModelPlayer.loadWeapon();
            }
            if (this._data.type == EAdvanceComponentType._EAdvanceComponentTypeWeapon)
            {
                _loc_2 = Cache.instance.role.entityInfo.career;
                switch(_loc_2)
                {
                    case ECareer._ECareerWarrior:
                    {
                        _loc_3 = 132;
                        _loc_4 = 280;
                        break;
                    }
                    case ECareer._ECareerArcher:
                    {
                        _loc_3 = 132 + 30;
                        _loc_4 = 240 - 30;
                        break;
                    }
                    case ECareer._ECareerMage:
                    {
                        _loc_3 = 132;
                        _loc_4 = 240;
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
                if (!this._isFightSoulDisposed)
                {
                    this.removeFightSoulPlayer();
                }
                if (this._isWeaponModelDisposed)
                {
                    this.initWeaponModel();
                    this._rect3d.addObject3d(this._weaponPlayer, _loc_3, _loc_4);
                    this._isWeaponModelDisposed = false;
                }
                if (this._roleModelPlayer == null)
                {
                    this.initUserModel();
                }
                _loc_1 = MountConfig.instance.getFashionInfoByCode(this._data.type, this._currSelCode);
                if (_loc_1 != null)
                {
                    _loc_5 = this._roleModelPlayer.getModelInfo(ModelType.WEAPONS, _loc_1.modelId);
                    this._weaponPlayer.load(_loc_5.mesh + ".md5mesh", _loc_5.texture, this._rect3d.renderList);
                    this._rect3d.addObject3d(this._weaponPlayer, _loc_3, _loc_4);
                    this.stopTurn();
                    if (this._frameTimer == null)
                    {
                        this._frameTimer = new FrameTimer();
                        this._frameTimer.addListener(TimerType.ENTERFRAME, this.onTimerFrameHandler);
                    }
                    this._frameTimer.start();
                    this.removeEffect();
                    _loc_6 = Cache.instance.role.roleEntityInfo.entityInfo.VIP;
                    if (_loc_5 && _loc_5.selfEffect && _loc_6 > 0)
                    {
                        this._weaponEffectPlayer = EffectPlayerPool.instance.getEffectPlayer(_loc_5.selfEffect, this._weaponPlayer, this._rect3d.renderList, true);
                        if (this._weaponEffectPlayer.temple is TempleRole)
                        {
                            (this._weaponEffectPlayer.temple as TempleRole).setRoleParams(this._weaponPlayer, null, null);
                        }
                        this._weaponEffectPlayer.play();
                    }
                }
                if (!this._isRoleModelDisposed)
                {
                    this.removeRoleModel();
                }
            }
            if (this._data.type == EAdvanceComponentType._EAdvanceComponentTypeFightSoul || this._data.type == EAdvanceComponentType._EAdvanceComponentTypeFightMethod || this._data.type == EAdvanceComponentType._EAdvanceComponentTypeDragonSoul || this._data.type == EAdvanceComponentType._EAdvanceComponentTypeHolyBook || this._data.type == EAdvanceComponentType._EAdvanceComponentTypeWarShield || this._data.type == EAdvanceComponentType._EAdvanceComponentTypeMonsterSoul)
            {
                this.updateFightSoulModel();
            }
            return;
        }// end function

        private function updateFightSoulModel() : void
        {
            var _loc_2:TModel = null;
            this.removeAllModel();
            var _loc_1:* = MountConfig.instance.getFashionInfoByCode(this._data.type, this._currSelCode);
            if (_loc_1)
            {
                _loc_2 = ModelConfig.instance.getInfoByCode(_loc_1.modelId);
                if (_loc_2)
                {
                    if (this._fightSoulModelPlayer == null)
                    {
                        this._fightSoulModelPlayer = FrObjectPool.getObject(ActionPlayer, this);
                        this._rect3d.addObject3d(this._fightSoulModelPlayer, 132 + 20 + 20, 280 + 60);
                        if (this._data.type == EFashionType._EFashionFightSoul)
                        {
                            this._fightSoulModelPlayer.scaleValue = 10;
                        }
                    }
                    this._fightSoulModelPlayer.load(_loc_2.mesh1 + ".md5mesh", _loc_2.bone1 + ".skeleton", _loc_2.texture1, this._rect3d.renderList);
                    this._fightSoulModelPlayer.play();
                    this._fightSoulEffectPlayer = EffectPlayerPool.instance.getEffectPlayer(_loc_2.effect1, null, this._rect3d.renderList, false);
                    this._fightSoulEffectPlayer.play(PlayMode.ANIMATION_LOOP_MODE);
                    if (this._fightSoulEffectPlayer.temple is TempleRole)
                    {
                        TempleRole(this._fightSoulEffectPlayer.temple).setRoleParams(this._fightSoulModelPlayer, null, null);
                    }
                    else
                    {
                        this._fightSoulModelPlayer.addChild(this._fightSoulEffectPlayer);
                    }
                    this._isFightSoulDisposed = false;
                }
            }
            return;
        }// end function

        private function onTimerFrameHandler(param1:FrameTimer) : void
        {
            this.modelTurn();
            return;
        }// end function

        private function removeEffect() : void
        {
            if (this._weaponEffectPlayer)
            {
                this._weaponEffectPlayer.dispose();
                this._weaponEffectPlayer = null;
            }
            return;
        }// end function

        private function stopTurn() : void
        {
            if (this._frameTimer)
            {
                this._frameTimer.stop();
            }
            this._turnNum = 0;
            return;
        }// end function

        private function modelTurn() : void
        {
            var _loc_1:* = this._turnNum + 0.1;
            this._turnNum = this._turnNum + 0.1;
            this._weaponPlayer.y = this._weaponPlayer.y + Math.cos(_loc_1) * 1;
            this._weaponPlayer.rotationY = this._weaponPlayer.rotationY + 5;
            return;
        }// end function

        protected function updateAdvanceInfo() : void
        {
            var _loc_2:String = null;
            var _loc_1:* = this.getLevelInfo((this._data.baseInfo.code + 1));
            if (_loc_1)
            {
                _loc_2 = FashionUtil.getFashionNameByType(this._data.type);
                this._advanceInfo.text = _loc_2 + this._data.advanceInfo.code + "→" + _loc_1.code + "进阶";
                this._advanceInfo.x = 133;
                this._advanceInfo.textColor = GlobalStyle.colorBaiUint;
            }
            else
            {
                this._advanceInfo.text = "已满阶";
                this._advanceInfo.x = 133 + 20;
                this._advanceInfo.textColor = GlobalStyle.colorHongUint;
            }
            return;
        }// end function

        protected function updateProgressInfo() : void
        {
            this._progressBar.setValue(this._data.advanceInfo.bless, this._data.baseInfo.blessMax);
            return;
        }// end function

        protected function updateConsumeInfo() : void
        {
            this._consumeItem.itemData = new ItemData(int(this._data.baseInfo.propConsume));
            this._propNum.text = "*" + this._data.baseInfo.propNum;
            this.updateConsumeState();
            return;
        }// end function

        protected function updateConsumeState() : void
        {
            var _loc_3:Boolean = false;
            var _loc_4:int = 0;
            var _loc_6:int = 0;
            var _loc_1:* = FashionUtil.getAdvanceTypeByFashionType(this._data.type);
            var _loc_2:* = Cache.instance.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupStuff, EStuff._EStuffAdvance, _loc_1);
            var _loc_5:* = this._data.baseInfo.propNum;
            while (_loc_6 < _loc_2.length)
            {
                
                if (ItemsUtil.isPrescriOutTime(_loc_2[_loc_6] as ItemData))
                {
                }
                else if (this._data.baseInfo.code >= (_loc_2[_loc_6] as ItemData).itemInfo.effect)
                {
                    _loc_4 = _loc_4 + (_loc_2[_loc_6] as ItemData).itemAmount;
                }
                _loc_6++;
            }
            if (_loc_4 >= _loc_5)
            {
                _loc_3 = true;
            }
            this._consumeItem.amount = _loc_4;
            this._consumeItem.enabled = _loc_3;
            return;
        }// end function

        protected function init3DRect() : void
        {
            this._rect3d = Rect3DManager.instance.registerWindow(true, new Rectangle(8, 35, 335, 467), this);
            Rect3DManager.instance.windowShowHander(null, this);
            return;
        }// end function

        protected function add3dBg() : void
        {
            if (this._rect3d)
            {
                this._img2d = new Img2D(null, this._bg.bitmapData, new Rectangle(0, 0, 335, 467), false);
                this._rect3d.addImg(this._img2d);
            }
            return;
        }// end function

        protected function initModel() : void
        {
            if (this._rect3d)
            {
                this.initUserModel();
                this.initWeaponModel();
                this.updateRoleModel();
            }
            return;
        }// end function

        private function initUserModel() : void
        {
            this._roleModelPlayer = FrObjectPool.getObject(UserModelPlayer, this);
            var _loc_1:* = Cache.instance.role.entityInfo.career;
            var _loc_2:* = Cache.instance.role.entityInfo.sex;
            var _loc_3:* = Cache.instance.role.roleEntityInfo.clothes;
            if (GameMapUtil.curMapState.isSunbathMap)
            {
                _loc_3 = 0;
            }
            var _loc_4:* = Cache.instance.role.roleEntityInfo.weapon;
            var _loc_5:* = Cache.instance.role.roleEntityInfo.hair;
            var _loc_6:* = Cache.instance.role.roleEntityInfo.wing;
            var _loc_7:* = Cache.instance.role.roleEntityInfo.entityInfo.VIP;
            this._roleModelPlayer.updateInfo(_loc_1, _loc_2, _loc_3, _loc_4, _loc_5, _loc_6, _loc_7);
            this._roleModelPlayer.scaleAll = 2.3;
            this._roleModelPlayer.useLight();
            this._roleModelPlayer.rotationX = 0;
            this._roleModelPlayer.rotationY = 0;
            this._rotate3d.model = this._roleModelPlayer;
            return;
        }// end function

        private function initWeaponModel() : void
        {
            this._weaponPlayer = FrObjectPool.getObject(WeaponPlayer, this);
            this._weaponPlayer.enabledPool = false;
            this._weaponPlayer.scaleX = 1.8;
            this._weaponPlayer.scaleY = 1.8;
            this._weaponPlayer.scaleZ = 1.8;
            this._weaponPlayer.rotationZ = -20;
            return;
        }// end function

        protected function play3DAdvanceEffect() : void
        {
            var _loc_1:String = null;
            var _loc_2:int = 0;
            if (this._rect3d)
            {
                this._rect3d.disposeObj3d(this._advanceEffectPlayer);
                _loc_1 = this._isCommonAdvance == true ? ("tuteng_2_zi") : ("tuteng_3_zi");
                this._advanceEffectPlayer = EffectPlayerPool.instance.getEffectPlayer(_loc_1, null, this._rect3d.renderList, false);
                if (this._isCommonAdvance)
                {
                    _loc_2 = 70;
                    this._advanceEffectPlayer.setScale(0.9, 0.9, 0.9);
                }
                else
                {
                    _loc_2 = 103 - 30;
                    this._advanceEffectPlayer.setScale(0.9, 0.9, 0.9);
                }
                this._advanceEffectPlayer.play(PlayMode.ANIMATION_STOP_MODE);
                FrEventDispatcher.instance.proxyAddEventListener(this._advanceEffectPlayer, Engine3dEventName.PLAYEND, this.playEndHander);
                this._rect3d.addObject3d(this._advanceEffectPlayer, 180 + 141 - 71 - 85, _loc_2 + 150);
            }
            return;
        }// end function

        protected function playEndHander(event:Event) : void
        {
            var _loc_2:* = event.currentTarget as EffectPlayer;
            if (this._rect3d)
            {
                this._rect3d.disposeObj3d(_loc_2);
            }
            return;
        }// end function

        private function removeRoleModel() : void
        {
            this._rect3d.disposeObj3d(this._roleModelPlayer);
            this._roleModelPlayer = null;
            this._isRoleModelDisposed = true;
            return;
        }// end function

        private function removeWeaponModel() : void
        {
            this.stopTurn();
            this._rect3d.disposeObj3d(this._weaponPlayer);
            this._weaponPlayer = null;
            this._isWeaponModelDisposed = true;
            return;
        }// end function

        private function removeFightSoulPlayer() : void
        {
            this._isFightSoulDisposed = true;
            this._rect3d.disposeObj3d(this._fightSoulEffectPlayer);
            this._fightSoulEffectPlayer = null;
            this._rect3d.disposeObj3d(this._fightSoulModelPlayer);
            this._fightSoulModelPlayer = null;
            return;
        }// end function

        private function removeAllModel() : void
        {
            if (!this._isRoleModelDisposed)
            {
                this.removeRoleModel();
            }
            if (!this._isWeaponModelDisposed)
            {
                this.removeWeaponModel();
            }
            if (!this._isFightSoulDisposed)
            {
                this.removeFightSoulPlayer();
            }
            return;
        }// end function

        protected function remove3D() : void
        {
            if (this._rect3d)
            {
                if (this._img2d)
                {
                    this._rect3d.removeImg(this._img2d);
                    this._img2d = null;
                }
                if (this._roleModelPlayer)
                {
                    this._rect3d.disposeObj3d(this._roleModelPlayer);
                    this._roleModelPlayer = null;
                }
                if (this._advanceEffectPlayer)
                {
                    this._rect3d.disposeObj3d(this._advanceEffectPlayer);
                    this._advanceEffectPlayer = null;
                }
                if (this._weaponPlayer)
                {
                    this._rect3d.disposeObj3d(this._weaponPlayer);
                    this._weaponPlayer = null;
                }
                if (this._weaponEffectPlayer)
                {
                    this._weaponEffectPlayer.dispose();
                    this._weaponEffectPlayer = null;
                }
                if (this._fightSoulEffectPlayer)
                {
                    this._fightSoulEffectPlayer.dispose();
                    this._fightSoulEffectPlayer = null;
                }
                if (this._fightSoulModelPlayer)
                {
                    this._fightSoulModelPlayer.dispose();
                    this._fightSoulModelPlayer = null;
                }
                Rect3DManager.instance.disposeRect3d(this._rect3d);
                this._rect3d = null;
            }
            return;
        }// end function

        protected function onAutoBuyClickHandler(event:MouseEvent) : void
        {
            if (this._autoBuy.selected == true)
            {
                ClientSetting.local.setIsDone(true, IsDoneType.AutoBuyAdvanceProp);
            }
            else
            {
                ClientSetting.local.setIsDone(false, IsDoneType.AutoBuyAdvanceProp);
            }
            return;
        }// end function

        protected function onOverHandler(event:MouseEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.FashionShowHidePreviewAttr, true));
            return;
        }// end function

        protected function onOutHandler(event:MouseEvent) : void
        {
            Dispatcher.dispatchEvent(new DataEvent(EventName.FashionShowHidePreviewAttr, false));
            return;
        }// end function

        protected function onFashionInfoUpdate(param1:Object) : void
        {
            var _loc_2:* = param1 as SAttributeUpdate;
            this._data = Cache.instance.fashion.getFashionInfo(this._data.type);
            if (_loc_2)
            {
                switch(_loc_2.attribute.value())
                {
                    case EEntityAttribute._EAttributeFashionBless:
                    {
                        this.updateProgressInfo();
                        break;
                    }
                    case EEntityAttribute._EAttributeFashionAdvancedNum:
                    {
                        break;
                    }
                    case EEntityAttribute._EAttributeFashionCode:
                    {
                        this.updateAll();
                        break;
                    }
                    case EEntityAttribute._EAttributeFashionShape:
                    {
                        this.updateChangeBtnState();
                        this.updateRoleModel();
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
            }
            return;
        }// end function

        protected function backPackItemChangeHandler(param1:Object) : void
        {
            this.updateConsumeState();
            return;
        }// end function

        protected function sortOnBind(param1:ItemData, param2:ItemData) : int
        {
            if (param1.bind == EBind._EBindYes && param2.bind == EBind._EBindNo)
            {
                return -1;
            }
            return 1;
        }// end function

        protected function onFashionAdvanceCompl(event:DataEvent) : void
        {
            var _loc_2:* = event.data as int;
            this._isCommonAdvance = _loc_2 == 0 ? (true) : (false);
            this.playSwfAdvanceEffect();
            this.play3DAdvanceEffect();
            return;
        }// end function

        protected function playSwfAdvanceEffect() : void
        {
            var _loc_1:String = null;
            if (!this._isPlaying)
            {
                _loc_1 = this._isCommonAdvance == true ? ("StrengDownCommonEffect.swf") : ("StrengDownPerfectEffect.swf");
                if (this._isCommonAdvance)
                {
                    this._swfPlayer.move(250 - 5 + 10 - 82, 107 + 252 + 70);
                }
                else
                {
                    this._swfPlayer.move(250 - 5 + 30 - 89, 107 + 244 - 23 + 91);
                }
                this._swfPlayer.load(_loc_1, FashionUtil.getSwfModelType(), null);
                this._swfPlayer.framesPlayerCompleteHandler = this.onAdvanceEffectEnd;
                this.contentTopOf3DSprite.addChild(this._swfPlayer);
                this._isPlaying = true;
            }
            return;
        }// end function

        protected function onAdvanceEffectEnd(param1:SWFPlayer) : void
        {
            this._swfPlayer.framesPlayerCompleteHandler = null;
            this._swfPlayer.stop();
            DisplayUtil.removeMe(this._swfPlayer);
            this._isPlaying = false;
            return;
        }// end function

        protected function stopAllEffect() : void
        {
            if (this._isPlaying)
            {
                this._isPlaying = false;
                this._swfPlayer.stop();
                DisplayUtil.removeMe(this._swfPlayer);
            }
            return;
        }// end function

        private function addArrow() : void
        {
            FashionUtil.addArrow(this._arrow, this.contentTopOf3DSprite, this._commonAdvanceBtn.x - 10, this._commonAdvanceBtn.y + 18);
            return;
        }// end function

        private function removeArrow() : void
        {
            FashionUtil.removeArrow(this._arrow);
            return;
        }// end function

        protected function getFashionAdvanceToolTipInfo() : ToolTipInfo
        {
            var _loc_1:BlessData = null;
            var _loc_2:Date = null;
            var _loc_3:int = 0;
            if (this._data)
            {
                _loc_1 = new BlessData();
                _loc_1.bless = this._data.advanceInfo.bless;
                _loc_1.blessClear = this._data.baseInfo.blessClear;
                _loc_2 = ClockManager.instance.nowDate;
                _loc_3 = Cache.instance.fashion.getFashionExpiredTime(this._data.type) - _loc_2.time / 1000;
                if (_loc_3 > 0)
                {
                    _loc_1.leftSeconds = _loc_3;
                }
                _loc_1.type = FashionUtil.getFashionNameByType(this._data.type);
                return new ToolTipInfo(TooltipType.Bless, _loc_1);
            }
            return null;
        }// end function

        override public function hide() : void
        {
            var winType:Boolean;
            var callBack:Function;
            var data:BlessData;
            var nowDate:Date;
            var leftTime:int;
            callBack = function (param1:int) : void
            {
                if (param1 == BlessClearWin.BlessBtnTypeOk)
                {
                }
                else if (param1 == BlessClearWin.BlessBtnTypeCacel)
                {
                    if (FashionAdvanceWin.instance.isHide)
                    {
                        return;
                    }
                    switch(_data.type)
                    {
                        case EFashionType._EFashionClothes:
                        {
                            _isShowClothBlessWin = false;
                            break;
                        }
                        case EFashionType._EFashionWing:
                        {
                            _isShowWingBlessWin = false;
                            break;
                        }
                        case EFashionType._EFashionWeapon:
                        {
                            _isShowArtifactBlessWin = false;
                            break;
                        }
                        case EFashionType._EFashionWeapon:
                        {
                            _isShowArtifactBlessWin = false;
                            break;
                        }
                        case EFashionType._EFashionWeapon:
                        {
                            _isShowArtifactBlessWin = false;
                            break;
                        }
                        case EFashionType._EFashionWeapon:
                        {
                            _isShowArtifactBlessWin = false;
                            break;
                        }
                        default:
                        {
                            break;
                        }
                    }
                    if (_hideCallBack != null)
                    {
                        _hideCallBack.call();
                    }
                    else
                    {
                        hide();
                    }
                }
                return;
            }// end function
            ;
            switch(this._data.type)
            {
                case EAdvanceComponentType._EAdvanceComponentTypeClothes:
                {
                    winType = this._isShowClothBlessWin;
                    break;
                }
                case EAdvanceComponentType._EAdvanceComponentTypeWing:
                {
                    winType = this._isShowWingBlessWin;
                    break;
                }
                case EAdvanceComponentType._EAdvanceComponentTypeWeapon:
                {
                    winType = this._isShowArtifactBlessWin;
                    break;
                }
                case EAdvanceComponentType._EAdvanceComponentTypeFightSoul:
                {
                    winType = this._isShowFightSoulBlessWin;
                    break;
                }
                case EAdvanceComponentType._EAdvanceComponentTypeFightMethod:
                {
                    winType = this._isShowFightMethodBlessWin;
                    break;
                }
                case EAdvanceComponentType._EAdvanceComponentTypeDragonSoul:
                {
                    winType = this._isShowDragonSoulBlessWin;
                    break;
                }
                default:
                {
                    break;
                }
            }
            if (winType && this._data.baseInfo.blessClear && this._data.advanceInfo.bless > 0)
            {
                if (BlessClearWin.instance.isHide)
                {
                    data = new BlessData();
                    data.bless = this._data.advanceInfo.bless;
                    data.blessClear = this._data.baseInfo.blessClear;
                    nowDate = ClockManager.instance.nowDate;
                    leftTime = Cache.instance.fashion.getFashionExpiredTime(this._data.type) - nowDate.time / 1000;
                    if (leftTime > 0)
                    {
                        data.leftSeconds = leftTime;
                    }
                    data.maxBless = this._data.baseInfo.blessMax;
                    data.type = FashionUtil.getFashionNameByType(this._data.type);
                    BlessClearWin.instance.show();
                    BlessClearWin.instance.blessData = data;
                    BlessClearWin.instance.callBack = callBack;
                }
                else
                {
                    BlessClearWin.instance.wiggle();
                }
            }
            else
            {
                super.hide();
                if (FashionActivityWin.hasInstance() && !FashionActivityWin.instance.isHide)
                {
                    FashionActivityWin.instance.hide();
                }
            }
            return;
        }// end function

        public function get isNeedShowBlessWin() : Boolean
        {
            var _loc_1:Boolean = false;
            switch(this._data.type)
            {
                case EFashionType._EFashionClothes:
                {
                    _loc_1 = this._isShowClothBlessWin;
                    break;
                }
                case EFashionType._EFashionWing:
                {
                    _loc_1 = this._isShowWingBlessWin;
                    break;
                }
                case EFashionType._EFashionWeapon:
                {
                    _loc_1 = this._isShowArtifactBlessWin;
                    break;
                }
                case EFashionType._EFashionFightSoul:
                {
                    _loc_1 = this._isShowFightSoulBlessWin;
                    break;
                }
                case EFashionType._EFashionFightMethod:
                {
                    _loc_1 = this._isShowFightMethodBlessWin;
                    break;
                }
                case EFashionType._EFashionDragonSoul:
                {
                    _loc_1 = this._isShowDragonSoulBlessWin;
                    break;
                }
                default:
                {
                    break;
                }
            }
            if (_loc_1 && this._data.baseInfo.blessClear && this._data.advanceInfo.bless > 0)
            {
                return true;
            }
            return false;
        }// end function

        public function hideWin() : void
        {
            super.hide();
            if (FashionActivityWin.hasInstance() && !FashionActivityWin.instance.isHide)
            {
                FashionActivityWin.instance.hide();
            }
            return;
        }// end function

        protected function onAdvanceHandler(event:MouseEvent) : void
        {
            var _loc_2:String = null;
            this._isStopAdvance = false;
            if (this._data.advanceInfo.code == FashionConst.FashionAdvanceMaxLevel)
            {
                _loc_2 = FashionUtil.getFashionNameByType(this._data.type);
                return MsgManager.showRollTipsMsg(_loc_2 + "已满阶");
            }
            if (this._isPlaying)
            {
                this.stopAllEffect();
            }
            if (event.target == this._commonAdvanceBtn)
            {
                if (this._isAddBtnFilter)
                {
                    this._isAddBtnFilter = false;
                    EffectManager.glowFilterUnReg(this._commonAdvanceBtn);
                    this.removeArrow();
                }
                this._isAutoAdvance = false;
                this.clothAdvance(this._isAutoAdvance);
            }
            else if (event.target == this._autoAdvanceBtn)
            {
                this._cancelBtn.visible = true;
                this._autoAdvanceBtn.visible = false;
                this._isAutoAdvance = true;
                this._callLaterId = CallLater.setCallLater(this.clothAdvance, 0.5, this._isAutoAdvance);
            }
            else if (event.target == this._cancelBtn)
            {
                this.cancelAutoAdvance();
            }
            return;
        }// end function

        private function clothAdvance(param1:Boolean) : void
        {
            var _loc_2:int = 0;
            var _loc_5:int = 0;
            var _loc_8:int = 0;
            if (this._isStopAdvance)
            {
                return;
            }
            switch(this._data.type)
            {
                case EFashionType._EFashionClothes:
                {
                    _loc_2 = EAdvanceType._EAdvanceTypeFashionClothesUp;
                    break;
                }
                case EFashionType._EFashionWing:
                {
                    _loc_2 = EAdvanceType._EAdvanceTypeFashionWingUp;
                    break;
                }
                case EFashionType._EFashionWeapon:
                {
                    _loc_2 = EAdvanceType._EAdvanceTypeFashionWeaponUp;
                    break;
                }
                case EFashionType._EFashionFightSoul:
                {
                    _loc_2 = EAdvanceType._EAdvanceTypeFashionFightSoulUp;
                    break;
                }
                case EFashionType._EFashionFightMethod:
                {
                    _loc_2 = EAdvanceType._EAdvanceTypeFashionFightMethodUp;
                    break;
                }
                case EFashionType._EFashionDragonSoul:
                {
                    _loc_2 = EAdvanceType._EAdvanceTypeFashionDragonSoulUp;
                    break;
                }
                default:
                {
                    break;
                }
            }
            var _loc_3:* = Cache.instance.pack.backPackCache.getItemsByGroupCategoryAndType(EGroup._EGroupStuff, EStuff._EStuffAdvance, _loc_2);
            _loc_3.sort(ItemsUtil.sortItem);
            var _loc_4:* = this._data.baseInfo.propNum;
            var _loc_6:* = new Dictionary();
            var _loc_7:* = _loc_3.length;
            while (_loc_8 < _loc_7)
            {
                
                if (ItemsUtil.isPrescriOutTime(_loc_3[_loc_8] as ItemData))
                {
                }
                else if (this._data.baseInfo.code >= (_loc_3[_loc_8] as ItemData).itemInfo.effect)
                {
                    _loc_5 = _loc_5 + (_loc_3[_loc_8] as ItemData).itemAmount;
                    _loc_6[(_loc_3[_loc_8] as ItemData).uid] = (_loc_3[_loc_8] as ItemData).itemAmount;
                    if (_loc_5 >= _loc_4)
                    {
                        _loc_6[(_loc_3[_loc_8] as ItemData).uid] = (_loc_3[_loc_8] as ItemData).itemAmount - _loc_5 + _loc_4;
                        break;
                    }
                }
                _loc_8++;
            }
            var _loc_9:* = ItemConfig.instance.getConfig(int(this._data.baseInfo.propConsume));
            var _loc_10:* = ShopConfig.instance.getFastBuyItemByCode(_loc_9.bind ? (_loc_9.codeUnbind) : (_loc_9.code)).prize * this._data.baseInfo.propNum;
            var _loc_11:* = Cache.instance.role.enoughMoney(EPriceUnit._EPriceUnitGoldBind, _loc_10, null, false);
            if (this._autoBuy.selected && _loc_5 < _loc_4 && !_loc_11 && GiftsUtil.isCanUseGift(_loc_9.group, _loc_9.category, _loc_9.type, this._data.advanceInfo.code))
            {
                if (param1)
                {
                    this.cancelAutoAdvance();
                }
            }
            else if (_loc_5 >= _loc_4 || this._autoBuy.selected)
            {
                GameProxy.fashion.advance(this._autoBuy.selected, this._data.type, _loc_6, param1);
            }
            else
            {
                MsgManager.showMouseMsg("道具不足", MsgRollTipsType.msgRollTips3);
                if (param1)
                {
                    this.cancelAutoAdvance();
                }
                if (GuideController.currentGuideItemWin == ModuleType.Fashion)
                {
                    GameController.playerSystem.view.hide();
                    GuideController.currentGuideItemWin = null;
                }
            }
            return;
        }// end function

        private function cancelAutoAdvance() : void
        {
            if (this._cancelBtn)
            {
                this._cancelBtn.visible = false;
            }
            if (this._autoAdvanceBtn)
            {
                this._autoAdvanceBtn.visible = true;
            }
            this._isAutoAdvance = false;
            return;
        }// end function

        private function onAutoAdvanceHandler(event:DataEvent) : void
        {
            this.clothAdvance(this._isAutoAdvance);
            return;
        }// end function

        private function onCancelAutoAdvance(event:DataEvent) : void
        {
            this.cancelAutoAdvance();
            return;
        }// end function

        public function set hideCallBack(param1:Function) : void
        {
            this._hideCallBack = param1;
            return;
        }// end function

        private function updateCd() : void
        {
            var _loc_1:Number = NaN;
            if (!this._data)
            {
                return;
            }
            switch(this._data.type)
            {
                case EFashionType._EFashionClothes:
                {
                    this._cdType = "ClothBlessClearCd";
                    break;
                }
                case EFashionType._EFashionWing:
                {
                    this._cdType = "WingBlessClearCd";
                    break;
                }
                case EFashionType._EFashionWeapon:
                {
                    this._cdType = "WeaponBlessClearCd";
                    break;
                }
                case EFashionType._EFashionFightSoul:
                {
                    this._cdType = "FightSoulBlessClearCd";
                    break;
                }
                case EFashionType._EFashionFightMethod:
                {
                    this._cdType = "FightMethodBlessClearCd";
                    break;
                }
                case EFashionType._EFashionDragonSoul:
                {
                    this._cdType = "DragonSoulBlessClearCd";
                    break;
                }
                default:
                {
                    break;
                }
            }
            if (this._data.baseInfo.blessClear && this._data.advanceInfo.bless > 0)
            {
                _loc_1 = this._data.advanceInfo.lastAdvanceSuccessDt.time - ClockManager.instance.nowDate.time;
                if (_loc_1 > 0)
                {
                    if (this._cdData == null)
                    {
                        this._cdData = Cache.instance.cd.registerCDData(CDDataType.publicCD, this._cdType, this._cdData);
                    }
                    this._cdData.totalTime = _loc_1;
                    this._cdData.beginTime = 0;
                    this._cdData.startCoolDown();
                    this._cdData.addFinishCallback(this.clearBless);
                }
                else
                {
                    this.clearBless();
                }
            }
            else if (this._cdData)
            {
                this._cdData.dispose();
                Cache.instance.cd.unregisterCDData(CDDataType.publicCD, this._cdType);
                this._cdData = null;
            }
            return;
        }// end function

        private function clearBless() : void
        {
            Cache.instance.fashion.clearBless(this._data.type);
            this.updateProgressInfo();
            if (this._cdData)
            {
                this._cdData.dispose();
                Cache.instance.cd.unregisterCDData(CDDataType.publicCD, this._cdType);
                this._cdData = null;
            }
            return;
        }// end function

        private function onClearBlessHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as int;
            if (_loc_2 == this._data.type)
            {
                this.updateProgressInfo();
            }
            return;
        }// end function

        private function onExpiredTimeUpdate(param1:Object) : void
        {
            this.updateCd();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._bg.dispose();
            this._leftBtn.dispose();
            this._rightBtn.dispose();
            this._changeBtn.dispose();
            this._imgHuaWenLeft.dispose();
            this._imgHuaWenRight.dispose();
            this._progressBar.dispose();
            this._consumeItem.dispose();
            this._commonAdvanceBtn.dispose();
            this._autoAdvanceBtn.dispose();
            this._autoBuy.dispose();
            this._levelInfo.dispose();
            this._advanceInfo.dispose();
            this._propNum.dispose();
            this._cancelBtn.dispose();
            this._txtAfterAdvance.dispose();
            this._swfPlayer.dispose();
            this._arrow.dispose();
            if (this._frameTimer)
            {
                this._frameTimer.dispose();
            }
            this._bg = null;
            this._leftBtn = null;
            this._rightBtn = null;
            this._changeBtn = null;
            this._imgHuaWenLeft = null;
            this._imgHuaWenRight = null;
            this._progressBar = null;
            this._consumeItem = null;
            this._commonAdvanceBtn = null;
            this._autoAdvanceBtn = null;
            this._autoBuy = null;
            this._levelInfo = null;
            this._advanceInfo = null;
            this._propNum = null;
            this._cancelBtn = null;
            this._txtAfterAdvance = null;
            this._swfPlayer = null;
            this._frameTimer = null;
            this._isPlaying = false;
            this._isCommonAdvance = false;
            this._arrow = null;
            this._currSelCode = 0;
            this._data = null;
            this._hideCallBack = null;
            this._isRoleModelDisposed = true;
            this._isWeaponModelDisposed = true;
            this._isFightSoulDisposed = true;
            this._isRightTop = false;
            this._isStopAdvance = false;
            FashionAdvanceWin.isOpenByOtherMethod = false;
            this._isAddBtnFilter = false;
            EffectManager.glowFilterUnReg(this._commonAdvanceBtn);
            this._turnNum = 0;
            this.remove3D();
            this.removeListeners();
            if (this._cdData)
            {
                this._cdData.dispose();
                Cache.instance.cd.unregisterCDData(CDDataType.publicCD, this._cdType);
                this._cdData = null;
            }
            this._cdType = null;
            return;
        }// end function

        public static function get instance() : FashionAdvanceWin
        {
            if (!_instance)
            {
                _instance = new FashionAdvanceWin;
            }
            return _instance;
        }// end function

        public static function hasInstance() : Boolean
        {
            return _instance != null;
        }// end function

    }
}
